home *** CD-ROM | disk | FTP | other *** search
/ ftp.mactech.com 2010 / ftp.mactech.com.tar / ftp.mactech.com / machack / Hacks97 / WarriorsProgress.sit / Warrior’s Progress / source code / Source / Libraries / Integers / Sign.h < prev    next >
Text File  |  1997-06-28  |  264b  |  23 lines

  1. // Sign.h
  2.  
  3. #ifndef Sign_h
  4. #define Sign_h
  5.  
  6. template < class Value >
  7. inline Value Abs( Value v )
  8.   {
  9.     return ( v < 0 ) ? -v : v;
  10.   }
  11.  
  12. template < class Value >
  13. inline Value Sign( Value v )
  14.   {
  15.     return ( v > 0 )
  16.              ? 1
  17.              : ( v < 0 )
  18.                  ? -1
  19.                  : 0;
  20.   }
  21.  
  22. #endif
  23.